extends /templates/core/modal-base

block modal-header-content
  .clearfix
  .text-center
    h2(data-i18n="courses.enroll_paid")
    if view.classroom
      p= view.classroom.get('name')

block modal-body-content
  - var usedLic = view.prepaids.totalRedeemers();
  - var totalLic = view.prepaids.totalMaxRedeemers();
  - var remainingLic = totalLic - usedLic;
  .text-center
    p
      strong.spr(data-i18n="courses.you_have1")
      strong= remainingLic
      strong.spl(data-i18n="courses.you_have2")

  .row
    .col-sm-10.col-sm-offset-1
      form.form
        if view.user
          .form-group
            .radio
              label
                input(type="radio", name="targets" value="given" checked=true)
                span.spr(data-i18n="courses.use_one")
                span= view.user.broadName()
            .radio
              label
                input(type="radio", name="targets" value="selection")
                span(data-i18n="courses.use_multiple")
        else
          p(data-i18n="courses.use_multiple")

        .well.form-group
          for user in view.users.models
            .checkbox
              label
                - var paid = user.get('coursePrepaidID')
                input(type="checkbox", disabled=paid, checked=true, data-user-id=user.id, name='user')
                span.spr= user.broadName()
                if paid
                  span (
                  span(data-i18n="courses.already_enrolled")
                  span )

        #error-alert.alert.alert-danger.hide

        #progress-area.hide
          .progress
            .progress-bar

        #submit-form-area.text-center
          p
            span.spr(data-i18n="courses.total_students")
            span#total-selected-span.spr
            span#not-depleted-span
              | (
              span.spr(data-i18n="courses.licenses_remaining")
              span#licenses-remaining-span
              | )
            span#depleted-span
              | (
              span(data-i18n="courses.insufficient_enrollments")
              | )

          p
            button#activate-licenses-btn.btn.btn-success.text-uppercase(type="submit", data-i18n="courses.enroll_students")

          p
            a#get-more-licenses-btn.btn.btn-info.text-uppercase(href="/courses/purchase", data-i18n="courses.get_enrollments")

block modal-footer-content
